package cloud.daodao.storm.common.user.model.security;

import cloud.daodao.storm.common.annotation.Sensitive;
import cloud.daodao.storm.common.serialize.Serializer;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.Pattern;
import jakarta.validation.constraints.Size;
import lombok.Data;

/**
 * @author DaoDao
 */
@Data
@Schema(title = "ChangePassword", description = "修改密码")
public class ChangePassword implements Serializer {

    @Schema(title = "oldPassword", description = "旧密码", example = "1")
    @NotEmpty
    @Size(min = 1, max = 20)
    private String oldPassword;

    @Schema(title = "newPassword", description = "新密码", example = "1")
    @NotEmpty
    @Size(min = 4, max = 20)
    @Pattern(regexp = "^(?=.*\\d)(?=.*[A-Z])(?=.*[a-z])[\\dA-Za-z_-]{4,20}$")
    @Sensitive(type = Sensitive.Type.PASSWORD)
    private String newPassword;

}
